<% unless session[:set_team].nil? %>
<strong>Showing Rotations for Team: <%= link_to "#{session[:set_team].name}",
												 :controller => 'teams',
												 :action => 'show',
												 :id => session[:set_team] %></strong>
<% @rotations = Rotation.find_by_team(session[:set_team]) %>

<% if @rotations.empty? %>
	<div id="message">
		This team has no rotations. Please create at least one <%= link_to "rotation",
		 														   :controller => 'teams',
																	:action => 'show',
																	:id => session[:set_team] %> in order to schedule staff.
	</div>
<% else %>

<% @rotations.each do |r| %>
<div class="<%= cycle("even", "odd") %>">
<% form_remote_tag :url => {:action => 'assign', :rotation_id => r.id } do -%>

<% @instance_types = InstanceType.find(:all) %>
<% @show_groups = Team.find(session[:set_team]).linked_groups %>

	<span><%= link_to "#{r.deployments.collect { |d| d.full_name }.to_sentence}",
	 				   :controller => 'rotations', :action => 'show', :id => r.id %>(<%= pluralize(r.weeks_on, 'week') %> on)</span>
	<span class="cell">
		<label for="instance_type_id">Select Instance</label><br/>
		<%= collection_select 'instance', 'type_id', @instance_types, :id, :name %>
	</span>
	
	<span class="cell">
		<label for="group_id">Select Group</label><br/>
		<%= collection_select 'group', 'id', @show_groups, :id, :name %>
	</span>
	
	<span class="cell">
		<label for="start_date">Start Date</label><br/>
		<%= date_field 'start', 'date', :format => '%Y-%m-%d', :size => 15 %>
	</span>
	
	<span class="cell">
		<%= submit_tag "Assign" %>
	</span>
	
<% end %>
</div>
<% end %><br><br>
<% end %>
<% end %>